package com.example.hello;

public class CellPhone {
    private String brand;
    private double price;

    public CellPhone(String brand, double price){
        this.brand = brand;
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CellPhone cellPhone = (CellPhone) o;

        if (Double.compare(cellPhone.price, price) != 0) return false;
        return brand.equals(cellPhone.brand);
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = brand.hashCode();
        temp = Double.doubleToLongBits(price);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        return result;
    }

    @Override
    public String toString() {
        return "CellPhone{" +
                "brand='" + brand + '\'' +
                ", price=" + price +
                '}';
    }
}
